{% extends 'dashboard/layout.html' %}
{% load i18n %}

{% block body_class %}{{ block.super }} content-blocks{% endblock %}

{% block headertext %}
    {% trans "Content blocks" %}
{% endblock %}

{% block title %}
    {% trans "Pages with content blocks" %} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}
    <ul class="breadcrumb">
        <li>
            <a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a>
        </li>
        <li>
            <a href="{% url 'dashboard:promotion-list' %}">{% trans "Content blocks" %}</a>
        </li>
        <li class="active">{% trans "Content blocks by page" %}</li>
    </ul>
{% endblock %}

{% block dashboard_content %}
    <div class="table-header">
        <h3><i class="icon-folder-open icon-large"></i>{% trans "View by page" %}</h3>
    </div>
    <div class="well">
        <a href="{% url 'dashboard:promotion-list' %}" class="btn btn-primary">{% trans "View all content blocks" %}</a>
        <a href="{% url 'dashboard:promotion-list-by-page' %}" class="btn btn-default">{% trans "View content blocks by page" %}</a>
    </div>

    <div class="table-header">
        <h2><i class="icon-folder-open icon-large"></i>{% trans "Pages with content blocks on them" %}</h2>
    </div>

    <table class="table table-striped table-bordered table-hover">
        {% if pages %}
            <thead>
                <tr>
                    <th>{% trans "URL" %}</th>
                    <th>{% trans "Number of content blocks" %}</th>
                    <th>{% trans "Actions" %}</th>
                </tr>
            </thead>
            <tbody>
                {% for page in pages %}
                    <tr>
                        <td><a href="{{ page.page_url }}">{{ page.page_url }}</a></td>
                        <td>{{ page.freq }}</td>
                        <td>
                            <a href="{% url 'dashboard:promotion-list-by-url' path=page.page_url %}" class="btn btn-success">{% trans "Edit" %}</a>
                        </td>
                        <td> </td>
                    </tr>
                {% endfor %}
            </tbody>
        {% else %}
            <tr><td>{% trans "No content blocks found." %}</td></tr>
        {% endif %}
    </table>
{% endblock dashboard_content %}
